<?php
    // 查询 message 表
    function get_message_data(){
        $result = mysql_query("SELECT * FROM message");
  
        $results = array();
        while ($row = mysql_fetch_assoc($result)) {
            $results[] = $row;
        }
    
        $arrData = createJsonData($results);
        
        echo json_encode($arrData);
    }

    // 添加 message 数据
    function insert_message_data(){
        $messageid = time() * 3;
        mysql_query("insert into message 
        (messageid , openid , recruitid , reply_time , content)  
        values 
        ('$messageid' , '$_POST[openid]' , 
        '$_POST[recruitid]' , '$_POST[reply_time]' , 
        '$_POST[content]')");
        
    }

    // 删除 message 数据
    function delete_message_data(){
        mysql_query("delete from message where Id='$_GET[Id]'");
    }

    // 根据 招聘信息 id 查看消息
    function get_message_by_recruit(){
        $result = mysql_query("select * from message where recruitid='$_POST[recruitid]'");
        
        $results = array();
        while ($row = mysql_fetch_assoc($result)) {
            $results[] = $row;
        }
    
        echo json_encode($results);
    }



?>